class OrderModel {
  int errno;
  Data data;
  String errmsg;

  OrderModel({this.errno, this.data, this.errmsg});

  OrderModel.fromJson(Map<String, dynamic> json) {
    errno = json['errno'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null;
    errmsg = json['errmsg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['errno'] = this.errno;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['errmsg'] = this.errmsg;
    return data;
  }
}

class Data {
  Address address;
  List<Address> addressList;
  Cart cart;

  Data({this.address, this.addressList, this.cart});

  Data.fromJson(Map<String, dynamic> json) {
    address =
        json['address'] != null ? new Address.fromJson(json['address']) : null;
    if (json['addressList'] != null) {
      addressList = new List<Address>();
      json['addressList'].forEach((v) {
        addressList.add(new Address.fromJson(v));
      });
    }
    cart = json['cart'] != null ? new Cart.fromJson(json['cart']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.address != null) {
      data['address'] = this.address.toJson();
    }
    if (this.addressList != null) {
      data['addressList'] = this.addressList.map((v) => v.toJson()).toList();
    }
    if (this.cart != null) {
      data['cart'] = this.cart.toJson();
    }
    return data;
  }
}

class Address {
  int id;
  String name;
  int userId;
  String province;
  String city;
  String county;
  String addressDetail;
  String areaCode;
  String tel;
  bool isDefault;
  String addTime;
  String updateTime;
  bool deleted;

  Address(
      {this.id,
      this.name,
      this.userId,
      this.province,
      this.city,
      this.county,
      this.addressDetail,
      this.areaCode,
      this.tel,
      this.isDefault,
      this.addTime,
      this.updateTime,
      this.deleted});

  Address.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    userId = json['userId'];
    province = json['province'];
    city = json['city'];
    county = json['county'];
    addressDetail = json['addressDetail'];
    areaCode = json['areaCode'];
    tel = json['tel'];
    isDefault = json['isDefault'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['userId'] = this.userId;
    data['province'] = this.province;
    data['city'] = this.city;
    data['county'] = this.county;
    data['addressDetail'] = this.addressDetail;
    data['areaCode'] = this.areaCode;
    data['tel'] = this.tel;
    data['isDefault'] = this.isDefault;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}

class Cart {
  int id;
  int userId;
  int goodsId;
  String goodsSn;
  String goodsName;
  int productId;
  double price;
  int number;
  List<String> specifications;
  bool checked;
  String picUrl;
  String addTime;
  String updateTime;
  bool deleted;

  Cart(
      {this.id,
      this.userId,
      this.goodsId,
      this.goodsSn,
      this.goodsName,
      this.productId,
      this.price,
      this.number,
      this.specifications,
      this.checked,
      this.picUrl,
      this.addTime,
      this.updateTime,
      this.deleted});

  Cart.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    userId = json['userId'];
    goodsId = json['goodsId'];
    goodsSn = json['goodsSn'];
    goodsName = json['goodsName'];
    productId = json['productId'];
    price = json['price'];
    number = json['number'];
    specifications = json['specifications'].cast<String>();
    checked = json['checked'];
    picUrl = json['picUrl'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['userId'] = this.userId;
    data['goodsId'] = this.goodsId;
    data['goodsSn'] = this.goodsSn;
    data['goodsName'] = this.goodsName;
    data['productId'] = this.productId;
    data['price'] = this.price;
    data['number'] = this.number;
    data['specifications'] = this.specifications;
    data['checked'] = this.checked;
    data['picUrl'] = this.picUrl;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}